# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-qrcode
_pkgname=qrcode
pkgver=6.1
pkgrel=4
pkgdesc='Python library to generate QR codes.'
url='https://pypi.org/project/qrcode/#files'
arch=('any')
license=('custom:unknown')
depends=('python2' 'python2-pillow6' 'python2-six' 'python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/qrcode-$pkgver.tar.gz")
sha512sums=('4831553932442f5535cba15d5958a656b399112f0f379c28ad9b610c33d88ec6d0613dc7047a2315606e49f027bfd13a15a332ce86b80040d56e1114a0f62251')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"

  mv "$pkgdir/usr/bin/qr" "$pkgdir/usr/bin/qr2"
  mv "$pkgdir/usr/share/man/man1/qr.1" "$pkgdir/usr/share/man/man1/qr2.1"
}

